<template>
  <div class="navbar">
    <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
    <div class="right-menu">
        <div class="avatar-container">
            <div class="avatar-wrapper">
                <el-avatar  shape="circle" fit="contain" :size="36" src="/favicon.ico" />
                <span :style="{color:'#fff',lineHeight:'50%',display:'inline-block',marginLeft:'8px'}">
                    <div>
                    {{ nickname?nickname:"name" }}
                    </div>
                </span>
            </div>
        </div>
    </div>
    <div class="right-menu right-menu-custom">
      <span>
        <div>
          培训科目专业：
        </div>
        <div style="display:flex;">
            <span>{{subjct}}</span>
        </div>
      </span>
    </div>
    <div class="right-menu right-menu-custom">
      <span>
        <div>
          身份证号：
        </div>
        <div>
          {{adminUserId}}
        </div>
      </span>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import { getsubjectTitle} from '@/utils/auth'

export default {
  components: {
    Breadcrumb,
  },
  data() {
    return {
      subjct:getsubjectTitle(),
    }
  },
  mounted(){
  },
  computed: {
    ...mapGetters(['sidebar', 'device', 'adminUserId', 'nickname','userinfor']),
    objBloon(){
      return this.sidebar.opened
    }
  },
  watch:{
    objBloon(val){
      if(val){
        document.getElementsByTagName('body')[0].style.setProperty('--typeWidth',"1"); 
      }else{
        document.getElementsByTagName('body')[0].style.setProperty('--typeWidth',"2"); 
      }
    }
  },
  methods: {
    toggleSideBar() {
      this.$store.dispatch('app/toggleSideBar')
    },
    async logout() {
      await this.$store.dispatch('user/logout')
      // this.$router.push('/login')
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
    },
    
  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/calculation.scss";
.navbar {
  height: 50px;
  overflow: hidden;
  position: fixed;
  width: 100%;
  z-index: 100;
  background: #313743;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  justify-content: center;
  align-items: center;

  .hamburger-container {
    line-height: 46px;
    height: 100%;
    float: left;
    cursor: pointer;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;

    &:hover {
      background: rgba(0, 0, 0, 0.025);
    }
  }

  .breadcrumb-container {
    float: left;
    margin-left:50px ;
  }

  .right-menu {
    float: right;
    height: 100%;
    line-height: 50px;
    margin-right: 50px;

    &:focus {
      outline: none;
    }

    .right-menu-item {
      display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      color: #5a5e66;
      vertical-align: text-bottom;

      &.hover-effect {
        cursor: pointer;
        transition: background 0.3s;

        &:hover {
          background: rgba(0, 0, 0, 0.025);
        }
      }
    }

    .avatar-container {
      margin-right: 30px;
        display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      color: #5a5e66;
      vertical-align: text-bottom;
      .avatar-wrapper {
        height: 100%;
        position: relative;
        display: flex;
        align-items: center;
        .user-avatar {
          cursor: pointer;
          width: 40px;
          height: 40px;
          border-radius: 10px;
        }

        .el-icon-caret-bottom {
          cursor: pointer;
          position: absolute;
          right: -20px;
          top: 25px;
          font-size: 12px;
        }
      }
    }
  }
  .right-menu-custom{
    span{
      display:flex;
      justify-content: center;
      align-items:center;
      color:#fff;
      font-size:14px;
    }
  }
}
</style>
